package com.zheng.sss.controller;


import com.zheng.sss.pojo.Result;
import com.zheng.sss.pojo.Resume;
import com.zheng.sss.service.imp.ResumeImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 *  @author: zheng
 *  @Date: 2020-06-25 20:47
 *  @Description:
 */
@Controller
@RequestMapping("resume")
public class ResumeController {

    @Autowired
    private ResumeImp resumeImp;

    @RequestMapping("selectAll")
    public String selectAllResume(Model model){
       List<Resume> list=resumeImp.selectListResume();
       model.addAttribute("list",list);
       return "list";
    }

    @RequestMapping("/update")
    @ResponseBody
    public Result update(Resume resume){
        resumeImp.updateResume(resume);
        return Result.build(200,"更新成功",null);
    }



    @RequestMapping("/save")
    @ResponseBody
    public Result save(Resume resume){
        resumeImp.addResume(resume);
        return Result.build(200,"保存成功",null);
    }

    @RequestMapping("/delete/{id}")
    @ResponseBody
    public Result delete(@PathVariable Long id){
        resumeImp.deleteResumeById(id);
        return Result.build(200,"删除成功",null);
    }








}
